struct RecentCounter {
    ping_list: Vec<i32>,
}


/**
  * `&self` means the method takes an immutable reference
  * If you need a mutable reference, change it to `&mut self` instead.
 */
impl RecentCounter {

    fn new() -> Self {
        Self {
            ping_list: vec![],
        }
    }

    fn ping(&mut self, t: i32) -> i32 {
        self.ping_list.push(t);
        let ret = self.ping_list.iter().filter(|&&ele| ele <= t && ele >= t - 3000).count();
        ret as i32
    }
}

/**
 * Your RecentCounter object will be instantiated and called as such:
 * let obj = RecentCounter::new();
 * let ret_1: i32 = obj.ping(t);
 */